[FLINK-39763][table] Allow inferring constants with IS NOT DISTINCT FROM#28256
Open
snuyanzin wants to merge 1 commit into
Open
[FLINK-39763][table] Allow inferring constants with IS NOT DISTINCT FROM#28256snuyanzin wants to merge 1 commit into
IS NOT DISTINCT FROM#28256snuyanzin wants to merge 1 commit into
Conversation
snuyanzin
commented
May 26, 2026
| <![CDATA[ | ||
| Calc(select=[a, b, CAST(2 AS INTEGER) AS d, e]) | ||
| +- MultipleInput(readOrder=[0,1], members=[\nHashJoin(joinType=[InnerJoin], where=[((a = d) AND (b = e))], select=[a, b, d, e], isBroadcast=[true], build=[right])\n:- HashAggregate(isMerge=[true], groupBy=[a], select=[a, Final_COUNT(count$0) AS b])\n: +- [#2] Exchange(distribution=[hash[a]])\n+- [#1] Exchange(distribution=[broadcast])\n]) | ||
| Calc(select=[CAST(2 AS INTEGER) AS a, b, CAST(2 AS INTEGER) AS d, e]) |
Contributor
Author
There was a problem hiding this comment.
the constant pulled up
snuyanzin
commented
May 26, 2026
| join | ||
| (select d, count(e) as e from MyTable2 group by d) | ||
| on a = d and b = e and d = 2 and b = 1 | ||
| ]]> |
Contributor
Author
There was a problem hiding this comment.
here and for other joins (except for NestedLoop)
now Calcite is able to understand that a == 2 and e == 1
after that it is able to push down these values to corresponding table sources
as a result non nested loop join will fail as there is only true in join condition.
when all joins are available then NestedLoop will be selected, there is also e2e case in DecimalITCase in this PR
Collaborator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What is the purpose of the change
The PRs enables Calcite's optimization for inferring constants https://issues.apache.org/jira/browse/CALCITE-5336
Brief change log
RexUtil
Verifying this change
Existing tests and updated tests
Does this pull request potentially affect one of the following parts:
@Public(Evolving): (no)Documentation
Was generative AI tooling used to co-author this PR?